package vn.codespot.hms.model.response;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import vn.codespot.hms.utils.JSonUtils;
import vn.codespot.hms.utils.LogUtil;

public class NationalResponseModel extends AbsResponseModel {
    public static final String NATIONAL = "national";

    private List<String> mNationals;

    public NationalResponseModel(String json) {
        super(Arrays.asList(NATIONAL));
        mNationals = new ArrayList<String>();
        parse(json);
    }

    public List<String> getNationals() {
        return mNationals;
    }

    @Override
    public void parse(String json) {
        try {
            mNationals.addAll(JSonUtils.getListStringValue(NATIONAL, JSonUtils.getRootJSonObject(json)));
        } catch (Exception e) {
            LogUtil.e("Exception: ", e);
        }
    }

    @Override
    public boolean isSuccess() {
        if (mNationals != null && !mNationals.isEmpty()) {
            return true;
        } else {
            return super.isSuccess();
        }
    }
}
